home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-19 / intrlib1.zip / INTR_LOC.H < prev    next >
C/C++ Source or Header  |  1992-02-23  |  5KB  |  147 lines

  1. /******************************************************************************
  2. * Iteraction library main header file (library local).                  *
  3. *                                          *
  4. *                    Written by Gershon Elber,  Oct. 1990  *
  5. *******************************************************************************
  6. * History:                                      *
  7. *  3 Oct 90 - Version 1.0 by Gershon Elber.                      *
  8. *  17 Feb 92 - Version 2.0 by Gershon Elber - support for DJGPP.          *
  9. ******************************************************************************/
  10.  
  11. #ifndef INTR_LOC_H
  12. #define INTR_LOC_H
  13.  
  14. #ifdef __MSDOS__
  15. #include <mem.h>
  16. #endif /* __MSDOS__ */
  17.  
  18. #define KEY_LEFT     256     /* Key Codes returned for operational keys. */
  19. #define KEY_RIGHT    257
  20. #define KEY_UP         258
  21. #define KEY_DOWN     259
  22. #define KEY_RETURN   260
  23. #define KEY_DELETE   261
  24. #define KEY_INSERT   262
  25. #define KEY_BSPACE   263
  26. #define KEY_ESC      264
  27. #define KEY_HOME     265
  28. #define KEY_END      266
  29. #define KEY_REFRESH  510
  30. #define KEY_NONE     511
  31.  
  32. #define TEXT_BORDER    8
  33. #ifdef DJGCC
  34. #define TEXT_BASE_LINE    14
  35. #else
  36. #define TEXT_BASE_LINE    10
  37. #endif /* DJGCC */
  38. #define SCROLL_BAR_WIDTH 24
  39.  
  40. #define MIN(x, y)        ((x) > (y) ? (y) : (x))
  41. #define MAX(x, y)        ((x) > (y) ? (x) : (y))
  42. #define BOUND(x, Min, Max)    (MAX(MIN(x, Max), Min))
  43.  
  44. #define ABS(x)            ((x) > 0 ? (x) : (-(x)))
  45. #define SQR(x)            ((x) * (x))
  46. #define SIGN(x)            ((x) > 0 ? 1 : ((x) < 0 ? -1 : 0))
  47.  
  48. #define SWAP(x, y, type)    { type temp = (x); (x) = (y); (y) = temp; }
  49.  
  50. #define APX_EQ(x, y)        (ABS((x) - (y)) < EPSILON)
  51.  
  52. #define GEN_COPY(Dest, Src, Size) memcpy(Dest, Src, Size)
  53. #define ZAP_MEM(Dest, Size)    memset(Dest, 0, Size);
  54.  
  55. #define DOT_PROD(Pt1, Pt2)    (Pt1[0] * Pt2[0] + \
  56.                  Pt1[1] * Pt2[1] + \
  57.                  Pt1[2] * Pt2[2])
  58.  
  59. #define DEG2RAD(Deg)        ((Deg) * M_PI / 180.0)
  60. #define RAD2DEG(Rad)        ((Rad) * 180.0 / M_PI)
  61.  
  62. #define _INTR_SCROLL_BAR_WIDTH    14              /* 14 pixels wide. */
  63.  
  64. /******************************************************************************
  65. * This macro is called when the library has detected an unrecoverable error.  *
  66. * Default action is to call IntrFatalError, but you may want to reroute this  *
  67. * to invoke your handler and recover yourself (by long jump for example).     *
  68. ******************************************************************************/
  69. #define FATAL_ERROR(Msg)    IntrFatalError(Msg);
  70.  
  71. #include "intr_lib.h"
  72.  
  73. typedef enum {
  74.     ASYNC_EVNT_NONE,
  75.     ASYNC_EVNT_PDMENU,
  76.     ASYNC_EVNT_HSCRLBAR,
  77.     ASYNC_EVNT_VSCRLBAR
  78. } AsyncEventType;
  79.  
  80. typedef struct {
  81.     AsyncEventType AsyncEvent;                    /* Type of async. event. */
  82.     IntrEventType IntrEvent;                      /* Type of intr event. */
  83.     _IntrWindowStruct *Window;                     /* Window of event. */
  84.     IntrRType R;
  85.     int X, Y;                       /* Location is screen coords. */
  86.     int PDBottom, PDLeft; /* Bottom Left coords of pull down menu activated. */
  87. } AsyncEventStruct;
  88.  
  89. extern IntrBType _IntrSaveBelow;
  90. extern int _IntrActiveDevices;
  91. extern IntrBType _IntrDetachKbdFromMouse;
  92. extern AsyncEventStruct _IntrAsyncLastEvent;
  93. extern int _IntrMouseSensitivity;
  94.  
  95. /* Global function that should be accessed by the library routines only: */
  96.  
  97. #if defined(__cplusplus) || defined(c_plusplus)
  98. extern "C" {
  99. #endif
  100.  
  101. VoidPtr _IntrMalloc(unsigned size);
  102. void _IntrFree(VoidPtr p);
  103. void _IntrAllocColors(void);
  104. void _IntrTextWndwDelete(_IntrWndwTextStruct *TextInfo);
  105. _IntrWindowStruct *_IntrFindWndwUsingID(int WindowID);
  106. _IntrWindowStruct *_IntrWndwGetWndwInPos(int x, int y);
  107. void _IntrWndwDrawFrame(int Xmin, int Xmax, int Ymin, int Ymax, int Width,
  108.             IntrColorType FrameColor, IntrBType SaveUnder,
  109.                         IntrColorType HScrlBarColor, IntrScrlBarType HScrlBar,
  110.                         IntrColorType VScrlBarColor, IntrScrlBarType VScrlBar,
  111.                         IntrBType HighIntensity);
  112. void _IntrWndwPutNameHeader(int Xmin, int Xmax, int Ymax, int FrameWidth,
  113.                 char *Str, IntrBType SaveUnder,
  114.                             IntrColorType FrameColor, IntrColorType ForeColor,
  115.                             IntrColorType BackColor, IntrBType HighIntensity);
  116. IntrBType _IntrIsInternalEvent(IntrEventType Event, int x, int y);
  117. void _IntrPullDownMenuDrawItems(IntrPullDownMenuStruct *PDMenu);
  118. void _IntrPullDownInvertEntry(int Index,
  119.                   _IntrWindowStruct *Window);
  120. int _IntrPullDownMatchPosition(int x, int y,
  121.                    _IntrWindowStruct *Window);
  122. void _IntrUpdateScrollBar(int Left,
  123.                   int Top,
  124.                   int Right,
  125.                           int Bottom,
  126.                   IntrRType RelativePosition,
  127.                           IntrRType DisplayedFraction,
  128.                           IntrBType IsVertical,
  129.                           IntrColorType ScrlBarColor);
  130. void _IntrBoundBBox(int *Xmin, int *Ymin, int *Xmax, int *Ymax, int Width);
  131.  
  132. IntrBType _IntrAllowInternalEvent(void);
  133. void _IntrSaveWindow(int Xmin, int Ymin, int Xmax, int Ymax);
  134. void _IntrRestoreWindow(void);
  135. void _IntrRestoreAll(void);
  136. int _IntrPopUpMenu(IntrPopUpMenuStruct *PUMenu,
  137.                    int Left,
  138.                    int Top);
  139. void _GRSetViewPort(int x1, int y1, int x2, int y2);
  140. void _GRSetViewPort2(int x1, int y1, int x2, int y2, IntrBType Clip);
  141.  
  142. #if defined(__cplusplus) || defined(c_plusplus)
  143. }
  144. #endif
  145.  
  146. #endif /* INTR_LOC_H */
  147.